home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QRZ! Ham Radio 7
/
QRZ Ham Radio Callsign Database - Volume 7.iso
/
mac
/
unix
/
src
/
pcall.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-11-01
|
2KB
|
108 lines
/*
** hdr.c
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <string.h>
#include "cb.h"
field_it(s,f)
char *s;
char *f[];
{
int i;
char *p;
if (p = strchr(s,'\n'))
*p = '\0';
i = 0;
f[i] = s;
while (*s)
{
if (*s == DELIMITER)
{
*s++ = '\0';
f[++i] = s;
}
else
s++;
}
}
pcall(buf,printcall)
char *buf;
int *(printcall)();
{
char *f[20];
char cbuf[256];
char datestr[16];
char effstr[16];
char formname[128];
char dispbuf[1024];
char addrbuf[128];
char pbuf[16];
char *p;
char *d;
int i;
strcpy(cbuf,buf);
memset(f,0,sizeof(f));
field_it(cbuf,f);
for (i=0;i<15;i++)
if ((f[i]) && (p=strchr(f[i],';')))
*p = ',';
p = f[CALL];
for (d=p; *p; p++)
if (*p != ' ')
*d++ = *p;
*d = '\0';
if (f[JR][0])
if (strlen(f[MI]))
sprintf(formname, "%s %s. %s %s",
f[FNAME], f[MI], f[LNAME], f[JR]);
else
sprintf(formname, "%s %s %s",
f[FNAME], f[LNAME], f[JR]);
else
if (strlen(f[MI]))
sprintf(formname, "%s %s. %s",
f[FNAME], f[MI], f[LNAME]);
else
sprintf(formname, "%s %s",
f[FNAME], f[LNAME]);
sprintf(addrbuf, "%s, %s %s", f[MAIL_CITY], f[MAIL_ST], f[MAIL_ZIP]);
jultodate(f[DOB],datestr);
jultodate(f[EFDATE],effstr);
sprintf(dispbuf, "\
%-8s%-40s Class: %s %s\n\
%-40s Born: %s\n\
%-40s",
f[CALL], formname, f[CLASS], effstr,
f[MAIL_STR], datestr, addrbuf);
if (strlen(f[P_CALL])) {
sprintf(pbuf," Prev: %s %-6s\n\n",
strlen(f[P_CLASS])?f[P_CLASS]:" ",f[P_CALL]);
strcat(dispbuf,pbuf);
} else
strcat(dispbuf,"\n\n");
printcall(dispbuf);
return ;
}